// 利用栈来匹配
; (function () {
    //return
    /**
   * @param {string} s
   * @return {boolean}
   */
    var isValid = function (s) {
        let arr =[]

        for (let index = 0; index < s.length; index++) {
            const element = s[index];

            if(element=='('){
                arr.push(")")
                continue
            }
            if(element=='{'){
                arr.push("}")
                continue
            }
            if(element=='['){
                arr.push("]")
                continue
            }

            if(arr.pop() != element){
                return false
            }
            
        }

        if(arr.length != 0) return false

        return true
    };
})();